/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package metamodel.impl;

import java.util.Collection;

import metamodel.BGMTModel;
import metamodel.BoardRule;
import metamodel.Dice;
import metamodel.MetamodelPackage;
import metamodel.Player;
import metamodel.Tile;
import metamodel.TileConnector;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>BGMT Model</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link metamodel.impl.BGMTModelImpl#getTiles <em>Tiles</em>}</li>
 *   <li>{@link metamodel.impl.BGMTModelImpl#getDice <em>Dice</em>}</li>
 *   <li>{@link metamodel.impl.BGMTModelImpl#getPlayers <em>Players</em>}</li>
 *   <li>{@link metamodel.impl.BGMTModelImpl#getRules <em>Rules</em>}</li>
 *   <li>{@link metamodel.impl.BGMTModelImpl#getTileconnectors <em>Tileconnectors</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BGMTModelImpl extends EObjectImpl implements BGMTModel {
	/**
	 * The cached value of the '{@link #getTiles() <em>Tiles</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTiles()
	 * @generated
	 * @ordered
	 */
	protected EList<Tile> tiles;

	/**
	 * The cached value of the '{@link #getDice() <em>Dice</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDice()
	 * @generated
	 * @ordered
	 */
	protected EList<Dice> dice;

	/**
	 * The cached value of the '{@link #getPlayers() <em>Players</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPlayers()
	 * @generated
	 * @ordered
	 */
	protected EList<Player> players;

	/**
	 * The cached value of the '{@link #getRules() <em>Rules</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRules()
	 * @generated
	 * @ordered
	 */
	protected EList<BoardRule> rules;

	/**
	 * The cached value of the '{@link #getTileconnectors() <em>Tileconnectors</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileconnectors()
	 * @generated
	 * @ordered
	 */
	protected EList<TileConnector> tileconnectors;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BGMTModelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MetamodelPackage.Literals.BGMT_MODEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Tile> getTiles() {
		if (tiles == null) {
			tiles = new EObjectContainmentEList<Tile>(Tile.class, this, MetamodelPackage.BGMT_MODEL__TILES);
		}
		return tiles;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Dice> getDice() {
		if (dice == null) {
			dice = new EObjectContainmentEList<Dice>(Dice.class, this, MetamodelPackage.BGMT_MODEL__DICE);
		}
		return dice;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Player> getPlayers() {
		if (players == null) {
			players = new EObjectContainmentEList<Player>(Player.class, this, MetamodelPackage.BGMT_MODEL__PLAYERS);
		}
		return players;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<BoardRule> getRules() {
		if (rules == null) {
			rules = new EObjectContainmentEList<BoardRule>(BoardRule.class, this, MetamodelPackage.BGMT_MODEL__RULES);
		}
		return rules;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<TileConnector> getTileconnectors() {
		if (tileconnectors == null) {
			tileconnectors = new EObjectContainmentEList<TileConnector>(TileConnector.class, this, MetamodelPackage.BGMT_MODEL__TILECONNECTORS);
		}
		return tileconnectors;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case MetamodelPackage.BGMT_MODEL__TILES:
				return ((InternalEList<?>)getTiles()).basicRemove(otherEnd, msgs);
			case MetamodelPackage.BGMT_MODEL__DICE:
				return ((InternalEList<?>)getDice()).basicRemove(otherEnd, msgs);
			case MetamodelPackage.BGMT_MODEL__PLAYERS:
				return ((InternalEList<?>)getPlayers()).basicRemove(otherEnd, msgs);
			case MetamodelPackage.BGMT_MODEL__RULES:
				return ((InternalEList<?>)getRules()).basicRemove(otherEnd, msgs);
			case MetamodelPackage.BGMT_MODEL__TILECONNECTORS:
				return ((InternalEList<?>)getTileconnectors()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MetamodelPackage.BGMT_MODEL__TILES:
				return getTiles();
			case MetamodelPackage.BGMT_MODEL__DICE:
				return getDice();
			case MetamodelPackage.BGMT_MODEL__PLAYERS:
				return getPlayers();
			case MetamodelPackage.BGMT_MODEL__RULES:
				return getRules();
			case MetamodelPackage.BGMT_MODEL__TILECONNECTORS:
				return getTileconnectors();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MetamodelPackage.BGMT_MODEL__TILES:
				getTiles().clear();
				getTiles().addAll((Collection<? extends Tile>)newValue);
				return;
			case MetamodelPackage.BGMT_MODEL__DICE:
				getDice().clear();
				getDice().addAll((Collection<? extends Dice>)newValue);
				return;
			case MetamodelPackage.BGMT_MODEL__PLAYERS:
				getPlayers().clear();
				getPlayers().addAll((Collection<? extends Player>)newValue);
				return;
			case MetamodelPackage.BGMT_MODEL__RULES:
				getRules().clear();
				getRules().addAll((Collection<? extends BoardRule>)newValue);
				return;
			case MetamodelPackage.BGMT_MODEL__TILECONNECTORS:
				getTileconnectors().clear();
				getTileconnectors().addAll((Collection<? extends TileConnector>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MetamodelPackage.BGMT_MODEL__TILES:
				getTiles().clear();
				return;
			case MetamodelPackage.BGMT_MODEL__DICE:
				getDice().clear();
				return;
			case MetamodelPackage.BGMT_MODEL__PLAYERS:
				getPlayers().clear();
				return;
			case MetamodelPackage.BGMT_MODEL__RULES:
				getRules().clear();
				return;
			case MetamodelPackage.BGMT_MODEL__TILECONNECTORS:
				getTileconnectors().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MetamodelPackage.BGMT_MODEL__TILES:
				return tiles != null && !tiles.isEmpty();
			case MetamodelPackage.BGMT_MODEL__DICE:
				return dice != null && !dice.isEmpty();
			case MetamodelPackage.BGMT_MODEL__PLAYERS:
				return players != null && !players.isEmpty();
			case MetamodelPackage.BGMT_MODEL__RULES:
				return rules != null && !rules.isEmpty();
			case MetamodelPackage.BGMT_MODEL__TILECONNECTORS:
				return tileconnectors != null && !tileconnectors.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //BGMTModelImpl
